<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
String outNumDeathRateInfoJson= (String)request.getAttribute("outNumDeathRateInfoJson");
String success= (String)request.getAttribute("success");
%>
<link href="${basePath}/static/css/Pigeonhole/Pigeonhole_list.css"
	rel="stylesheet" type="text/css">
<link rel="stylesheet"
	href="${basePath}/static/css/medicalRecord_Search/medicalSearch.css" />
<script type="text/javascript"
	src="${basePath}/static/publics/assets/jqPaginator/jqPaginator.js"></script>
	<script type="text/javascript" src="${basePath}assets/js/echarts.js"></script>
<div class="list_NR">
	<div class="loc">
		<h3>统计报告</h3>
		<ul class="loc_loc">出院人数和死亡率
		</ul>
	</div>

	<div class="list_con_table">
		
	<table style="width:100%;" cellpadding="0" cellspacing="0" id="table">
<tbody>
	   <tr>
		
		  <td colspan="6" style="text-align:right;">
		      <input type="button" value="保存" class="btn"  onclick="saveOutDeathRate()">
		      
		      
		       <input type="button" value="导出" class="btn"  onclick="exportOutDeathRate()">
		      
		  </td>
	   </tr>
			
			<tr>
			   <td class="tdLabel_7" style="width:10%">出院人数及死亡率</td>
				
			
				<td class="tdLabel_8" colspan="7">
					<textarea style="width:95%;height:120px" name="note">${outNumDeathRateInfo.outNumDeathRateText}</textarea>
				</td>
			</tr>
			
		    <tr>
			   <td class="tdLabel_7" style="width:10%">说明</td>
				<td class="tdLabel_8" colspan="7">
					<textarea style="width:95%;height:120px" id="note">${outNumDeathRateInfo.outNumDeathRateNote}</textarea>
				</td>
			</tr>
			
			 <tr>
				 <td class="tdLabel_7">
				 	图2  出院人数及死亡率
				 </td>
				<td class="tdLabel_8" colspan="5" style="height:400px;">
						<div id="container" style="height: 400px;width:100%"></div>
					
				</td>
			 </tr>
			
	
			
		</tbody>
</table>
	


	</div>




</div>
<script type="text/javascript"
	src="${basePath}/static/publics/assets/My97DatePicker/WdatePicker.js"></script>


<script>
var  myChart;



function exportOutDeathRate(){
   var month = $("#month").val();
   var base64info = myChart.getDataURL();
   $.ajax({
      type:"post",
      data:{image:base64info,method:'getImage'},
      url:"${basePath}/report/exportOutDeathRate",
      success:function(data){
           window.location.href ="${basePath}/report/exportOutDeathRate?method=export&month="+month;
      }
   })
}


 //保存
 function saveOutDeathRate(){
 
     var note = $("#note").val();
     var base64info = myChart.getDataURL();
	   $.ajax({
	       type:"post",
	       data:{note:note,image:base64info},
	       url:"${basePath}/report/saveOutDeathRate",
	       success:function(data){
	    	   layer.alert(data.msg,{icon:1});
	       }
	   })

 }
 
 //初始化图表信息
 $(function(){
	var outNumDeathRateInfoJson= <%=outNumDeathRateInfoJson%>;
	if(null!=outNumDeathRateInfoJson){
	   initCharSet(outNumDeathRateInfoJson);
	}
	
 });
 

 //charset图表
 function initCharSet(params){
  var dom = document.getElementById("container");
  myChart = echarts.init(dom);
var app = {};
option = null;
app.title = '折柱混合';

option = {
tooltip: {
    trigger: 'axis',
    axisPointer: {
        type: 'cross',
        crossStyle: {
            color: '#999'
        }
    }
},

legend: {
    data:['出院人次','死亡率'],
    y: 'bottom'
},
xAxis: [
    {
        type: 'category',
        data: params.monthList,
        axisPointer: {
            type: 'shadow'
        }
    }
],
yAxis: [
    {
        type: 'value',
        name: '出院人次',
      /*   min: 0,
        max: 20000,
        interval: 2000, */
        axisLabel: {
            formatter: '{value}'
        }
    },
    {
        type: 'value',
        name: '死亡率%',
        min: 0.1,
        max: 1,
        interval: 0.1,
        axisLabel: {
            formatter: '{value}'
        }
    }
],
series: [
    
    {
        name:'出院人次',
        type:'bar',
         barWidth:90,
        data:params.outNumList
    },
    {
        name:'死亡率',
        type:'line',
        yAxisIndex: 1,
        data:params.deathRateList
    }
]
};
;
if (option && typeof option === "object") {
myChart.setOption(option, true);
}
 }
 
 
</script>